#include "acquaintance.h"
#include "ui_acquaintance.h"
#include <QPainter>
#include <QFont>
#include <QPixmap>
#include <QTimer>

int i3=1;

acquaintance::acquaintance(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::acquaintance)
{
    ui->setupUi(this);
}

void acquaintance::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    painter.setPen(Qt::black);//设置画笔颜色
    painter.setBrush(Qt::black);//设置填充颜色
    painter.drawRect(0,0,480,480);
    int x1=ui->qhframe->pos().x();
    int y1=ui->qhframe->pos().y();
    qh[0].load(":/resourse/0.png") ;
    qh[1].load(":/resourse/1.png") ;
    qh[2].load(":/resourse/2.png") ;
    qh[3].load(":/resourse/3.png") ;
    qh[4].load(":/resourse/4.png") ;
    qh[5].load(":/resourse/5.png") ;
    qh[6].load(":/resourse/6.png") ;
    qh[7].load(":/resourse/7.png") ;
    qh[8].load(":/resourse/8.png") ;
    qh[9].load(":/resourse/9.png") ;
    qh[10].load(":/resourse/10.png") ;
    qh[12].load(":/resourse/12.png") ;
    qh[13].load(":/resourse/13.png") ;
    qh[14].load(":/resourse/14.png") ;
    qh[15].load(":/resourse/15.png") ;
    qh[16].load(":/resourse/16.png") ;
    qh[17].load(":/resourse/17.png") ;
    qh[18].load(":/resourse/18.png") ;
    qh[19].load(":/resourse/19.png") ;
    qh[20].load(":/resourse/20.png") ;
    qh[21].load(":/resourse/21.png") ;
    qh[22].load(":/resourse/22.png") ;
    qh[23].load(":/resourse/23.png") ;
    qh[24].load(":/resourse/24.png") ;
    qh[25].load(":/resourse/25.png") ;
    QFont font1("Courier New",10);
    painter.setFont(font1);
    painter.setPen(Qt::red);
    painter.setBrush(Qt::red);
    painter.drawText(10,185,dialog[i3]);

    if (i3==1)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[15]);
    }
    if (i3==2)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[16]);
    }

    if (i3==3)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[5]);
    }
    if (i3==4)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[7]);
    }
    if (i3==5)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[19]);
    }
    if (i3==6)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[10]);
    }
    if (i3==7)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[9]);
    }
    if (i3==8)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[21]);
    }
    if (i3==9)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[18]);
    }
    if (i3==10)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[7]);
    }
    if (i3==11)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[6]);
    }
    if (i3==12)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[7]);
    }
    if (i3==13)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[19]);
    }
    if (i3==14)
    {
        painter.drawPixmap(x1,y1,ui->qhframe->width(),ui->qhframe->height(),qh[1]);
    }
    if (i3==15)
    {
        this->close();
        Game3 *g3 =new Game3();
        g3->show();
    }

}

void acquaintance::on_nextpushButton_clicked()
{
    i3++;
    update();
}

acquaintance::~acquaintance()
{
    delete ui;
}
